<%inherit file="/base/index.html"/>

<%def name="js()" >
	<script type="text/javascript">
	// Prototypal Inheritance
	if (typeof Object.create !== 'function') {
	    Object.create = function (o) {
	        function F() {}
	        F.prototype = o;
	        return new F();
	    };
	}

	</script>
	${parent.js_link('/js/jquery.min.js')}
	${parent.js_link('/js/LC_prototypes-min.js')}
	${parent.js()}
	<script type="text/javascript">
	## UI Controller:
	var MA_UI_Controller = {
		start_ui: null,
		start_hid: null,
		old_ui: null,
		old_hid: null,
		init: function() {
			if (!(this.start_hid) && !(this.start_ui)) {
				this.start_ui = $('#ui').find(':visible');
				this.start_hid = $('#ui').find('[style*="display"]').filter(':hidden');
			} else {
				this.start_ui.show();
				this.start_hid.hide();
			}
			this.set();
		},
		set: function() {
			this.old_ui = $('#ui').find(':visible');
			this.old_hid = $('#ui').find('[style*="display"]').filter(':hidden');
		},
		restore: function() {
			this.old_ui.show();
			this.old_hid.hide();
		}
	}
	</script>
	
</%def>

<%namespace name="menu_nav" file="/components/menu.mako"/>

<script type="text/javascript">
    YAHOO.util.Event.onContentReady("monadminmenu", function () {
    var oMenu = new YAHOO.widget.Menu("monadminmenu",{
		position: "static",
		hidedelay: 750,
		lazyload: true});
    oMenu.render();
    oMenu.show();
	$(oMenu.srcElement).css('z-index', 99)
	${self.dom_ready()}
	});
</script>

${next.body()}


<%def name="top_nav()">
  ${menu_nav.top_nav(c.top_nav, c.top_nav_active)}
</%def>

<%def name="user_info()">

<% 
if session.has_key('user_client_dn'):
    dn =  session['user_client_dn'] 
    ca = session['user_client_ca'] 
elif session.has_key('user_slcs_obj'):
    slcs_obj = session['user_slcs_obj']
    dn = slcs_obj.get_dn() 
    ca = slcs_obj.get_ca() 
else:
    dn = 'Guest'
    ca = ''
%>


<script type="text/javascript"> 

    var tag = 'div#user-info';
    var _html = "<div id='ui_short'>${c.user_name} ${c.user_surname} </div>";

    _html += "<div id= 'ui_long'>${dn} <br />(${ca}) </div>";
    
    $(tag).html(_html);
    
    $('#ui_short').css('display','inline');
    $('#ui_long').hide();
    
    $(tag).click(function() {
        $("#ui_long").toggle();
        $("#ui_short").toggle();
    });
</script>
</%def>

<%def name="menu()">
    ${menu_nav.menu(c.menu,c.menu_active,'monadminmenu')}
</%def> 

<%def name="css()">
  ${parent.css()}
  ${parent.css_link('/css/LC_prototypes.css', 'screen')}
</%def>

<%def name="dom_ready()" ></%def>



